package com.excilys.dao;

import java.util.List;

import org.joda.time.DateTime;

import com.excilys.model.Transaction;

/**
 * Interface for a transaction DAO
 * 
 * @author excilys dev : YA, SC, VP
 * 
 */
public interface ITransactionDAO {

	/**
	 * 
	 * Used in accountDetailsController for account details via
	 * TransactionService. Retrieves the list of all transactions by date.
	 * 
	 * @param accountId
	 * @param currentDate
	 * @return a list of transactions
	 */
	List<Transaction> getAllTransactionsByAccountIdByMonthAndYear(long accountId, DateTime currentDate);

	/**
	 * 
	 * Used in accountDetailsController for account details via
	 * TransactionService. Retrieves the list of transfer and check transactions
	 * by date.
	 * 
	 * @param accountId
	 * @param currentDate
	 * @return a list of check and transfer transactions
	 */
	List<Transaction> getAllTransactionsCheckTransferByAccountIdByMonthAndYear(Long accountId, DateTime currentDate);

	/**
	 * 
	 * Used on accountDetailsController for account details via
	 * TransactionService. Retrieves the list of transfer and check transactions
	 * by date. The offset sets a result list of MAX_RESULT elements.
	 * 
	 * @param accountId
	 * @param currentDate
	 * @param offset
	 * @return a list of 20 transfer and check transactions depending on page
	 *         number
	 */
	List<Transaction> getAllTransactionsCheckTransferByAccountIdByMonthAndYear(long accountId, DateTime currentDate, int offset);

	/**
	 * 
	 * Used in accountDetailsController for account details via
	 * TransactionService. Retrieves the list of card transactions by date.
	 * 
	 * @param accountId
	 * @param currentDate
	 * @return a list of card transactions
	 */
	List<Transaction> getAllTransactionsCardByAccountIdByMonthAndYear(Long accountId, DateTime currentDate);

	/**
	 * 
	 * Used in accountDetailsController for account details via
	 * TransactionService. Retrieves the list of card transactions by date. The
	 * offset sets a result list of 20 elements.
	 * 
	 * @param accountId
	 * @param currentDate
	 * @param offset
	 * @return a list of 20 card transactions depending on page number
	 */
	List<Transaction> getAllTransactionsCardByAccountIdByMonthAndYear(Long accountId, DateTime currentDate, int offset);

	/**
	 * Used by transfer form to perform a transfer between two accounts
	 * registered in transactionAccount_accounId (source account) and
	 * transferAccount_accountId (target account). Performs a plain persistence.
	 * 
	 * @param sourceAccountName
	 * @param targetAccountName
	 * @param transferAmount
	 */
	void setTransferTransaction(String sourceAccountName, String targetAccountName, double transferAmount);

}
